﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;

namespace Tanmia.Controls
{
    /// <summary>
    /// Interaction logic for ValidationTool.xaml
    /// </summary>
    public partial class ValidationTool : UserControl
    {
        //public new static readonly DependencyProperty BorderThicknessProperty = DependencyProperty.Register("BorderThickness", typeof(Thickness), typeof(ValidationTool), new FrameworkPropertyMetadata(new Thickness(1)));
        //public static readonly DependencyProperty CornerRadiusProperty = DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(ValidationTool), new FrameworkPropertyMetadata(new CornerRadius(2)));
        public static readonly DependencyProperty ValidTypeProperty = DependencyProperty.Register("ValidType", typeof(ValidType), typeof(ValidationTool), new FrameworkPropertyMetadata(new ValidType()));
        public static readonly DependencyProperty LabelProperty = DependencyProperty.Register("Label", typeof(string), typeof(ValidationTool), new FrameworkPropertyMetadata(new string(new char(), 1)));

        public ValidType ValidType
        {
            get { return (ValidType)GetValue(ValidTypeProperty); }
            set { SetValue(ValidTypeProperty, value); object o = VImage; }
        }

        public string Label
        {
            get { return (string)GetValue(LabelProperty); }
            set
            {
                SetValue(LabelProperty, value);
            }
        }

        public ValidationTool()
        {
            InitializeComponent();

            DataContext = this;
        }

        public BitmapImage VImage
        {
            get
            {
                BitmapImage bi = null;

                switch (ValidType)
                {
                    case Controls.ValidType.Error:
                        bi = new BitmapImage(new Uri(@"/Tanmia.Controls;component/Error.png", UriKind.Relative));
                        break;
                    case Controls.ValidType.Info:
                        bi = new BitmapImage(new Uri(@"/Tanmia.Controls;component/Info.png", UriKind.Relative));
                        break;
                    case Controls.ValidType.Warning:
                        bi = new BitmapImage(new Uri(@"/Tanmia.Controls;component/Warning.png", UriKind.Relative));
                        
                        break;
                }

                return bi;
            }
        }
    }
}
